<template>
<div>
  <fm-making-form 
  ref="makingform" 
  style="height: 500px;" 
  preview 
  generate-code 
  generate-json
>
</fm-making-form>
<div>
  <el-input v-model="names" placeholder="请输入内容"></el-input>
   <el-button @click="Add">提交表单</el-button>
   
</div>
</div>
</template> 
<script>
export default {
    
  data () {
    return {
      names:'',
      table:{
          id:'',
        names:'',
        text:'',
      }
    }
  },
  methods: {
    handleSubmit () {
      
      this.$refs.generateForm.getData().then(data => {
        alert(JSON.stringify(data))
      }).catch(e => {
      })
    },
    Add(){
      var json = this.$refs.makingform.getJSON();
      
      this.table.names = this.names;
      this.table.text = JSON.stringify(json)
      console.log(this.table);
      this.axios.post('https://localhost:44347/CreateTK',this.table)
      .then(Response=>{
        if(Response.data>0)
        {
          alert("提交成功");
        }
      })
    },
    previewHide(){
      this.previewVisible = false;
    },
    handleDataChange () {
    }
  }
}
</script>